package com.sad.jetpack.v1.datamodel.api.extension.client.socket.ipc;


public class DefaultIPCChatRunnable extends AbsIPCChatRunnable {

    public DefaultIPCChatRunnable(){}

    public DefaultIPCChatRunnable(IPCChatSession chatSession) {
        setChatSession(chatSession);
    }


    private int cacheSize=7;
    @Override
    public void run() {
        getChatSession().onReadyToStartLoopingChat(this,cacheSize);
        while (!isExit()){
            try {
                getChatSession().onLoopingChat(this,cacheSize);
            }catch (Exception e){
                e.printStackTrace();
                end();
                if (exceptionListener!=null){
                    exceptionListener.onChatRunnableException(getSelfMember(),e);
                }
            }

        }
    }

}
